﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Trauberman.SOChat.StarLeaderboard.Domain;
using Trauberman.SOChat.StarLeaderboard.Models;
using Trauberman.SOChat.StarLeaderboard.Services;


namespace Trauberman.SOChat.StarLeaderboard.Controllers
{
    public class UserController : Controller
    {
        private IStarService _starSvc;

        public UserController(IStarService starService)
        {
            this._starSvc = starService;
        }

        public ActionResult Index(int id)
        {
            UserModel model = new UserModel();
            model.UserId = id;
            model.Messages = _starSvc.GetStarsByUser(id);
            model.UserName = model.Messages.First().User.Name;
            
            return View(model);
        }

    }
}
